<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    console.dir(Array);


    // 静态方法: 存储在构造函数本身 => 构造函数自己用的
    // Array.isArray()
    // Array.from()
    // Array.of()

    // 动态方法: 构造函数的原型对象 prototype  => 给构造函数创建的实例化对象访问 (Array => [] 数组)

    // var arr = new Array();
    // console.log(arr);
    // arr.push(1, 2, 3, 4);
    // console.log(arr);

    Array.prototype.myEach = function (fn) {
        // this -> 调用此方法的实例化对象
        for (var i = 0; i < this.length; i++) {
            var item = this[i];
            var index = i;
            var array = this;
            fn(item, index, array);
        }
    }

    var arr = [1, 2, 3, 4];
    arr.myEach(function (item, index, array) {
        console.log(item, index, array);
    })




</script>

</html>